home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1993 / MacHack 1993.toast / MacHack™ 1987-1992 / MacHack™ '90 / Source Code ƒ / MPW C ƒ / Orphan ƒ / OrphanFiles.sit / StripUnitsTool.c < prev    next >
MacBinary  |  1990-02-09  |  2.8 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Fri Feb 9 10:21:09 1990, modified Fri Feb 9 10:21:09 1990, creator 'MPS ', type ASCII, 2213 bytes "StripUnitsTool.c" , at 0x925 382 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 10 53 74 72 69 70 55 | 6e 69 74 73 54 6f 6f 6c |..StripU|nitsTool|
|00000010| 2e 63 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.c......|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 08 a5 00 | 00 01 7e a1 f8 90 65 a1 |........|..~...e.|
|00000060| f8 90 65 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..e.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 07 05 00 00 |........|........|
|00000080| 2f 2a 20 20 4c 69 6b 65 | 20 74 68 65 20 4d 50 57 |/* Like| the MPW|
|00000090| 20 33 2e 30 20 54 6f 6f | 6c 20 74 6f 20 4f 72 70 | 3.0 Too|l to Orp|
|000000a0| 68 61 6e 46 69 6c 65 73 | 2c 20 74 68 69 73 20 73 |hanFiles|, this s|
|000000b0| 74 72 69 70 73 20 27 75 | 6e 69 74 27 20 72 65 73 |trips 'u|nit' res|
|000000c0| 6f 75 72 63 65 73 20 20 | 20 20 20 20 20 20 20 2a |ources | *|
|000000d0| 2f 0d 2f 2a 20 20 54 68 | 69 73 20 6d 69 67 68 74 |/./* Th|is might|
|000000e0| 20 77 6f 72 6b 20 6f 6e | 20 32 2e 30 2e 32 20 2d | work on| 2.0.2 -|
|000000f0| 2d 20 49 20 68 61 76 65 | 6e 27 74 20 74 72 69 65 |- I have|n't trie|
|00000100| 64 20 2d 2d 20 49 20 64 | 6f 6e 27 74 20 73 65 65 |d -- I d|on't see|
|00000110| 20 77 68 79 20 69 74 20 | 77 6f 75 6c 64 6e 27 74 | why it |wouldn't|
|00000120| 20 2a 2f 0d 0d 0d 2f 2a | 20 4d 50 57 20 43 3a 20 | */.../*| MPW C: |
|00000130| 28 33 2e 30 20 6f 72 20 | 6c 61 74 65 72 29 20 2a |(3.0 or |later) *|
|00000140| 2f 0d 0d 23 69 6e 63 6c | 75 64 65 20 3c 73 74 64 |/..#incl|ude <std|
|00000150| 69 6f 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |io.h>.#i|nclude <|
|00000160| 73 74 72 69 6e 67 2e 68 | 3e 0d 23 69 6e 63 6c 75 |string.h|>.#inclu|
|00000170| 64 65 20 3c 72 65 73 6f | 75 72 63 65 73 2e 68 3e |de <reso|urces.h>|
|00000180| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 63 75 72 73 6f |.#includ|e <curso|
|00000190| 72 63 74 6c 2e 68 3e 0d | 0d 6d 61 69 6e 28 69 6e |rctl.h>.|.main(in|
|000001a0| 74 20 61 72 67 63 2c 20 | 63 68 61 72 20 2a 61 72 |t argc, |char *ar|
|000001b0| 67 76 5b 5d 29 0d 7b 0d | 20 20 20 20 63 68 61 72 |gv[]).{.| char|
|000001c0| 20 69 2c 20 6a 2c 20 6b | 3b 0d 20 20 20 20 73 68 | i, j, k|;. sh|
|000001d0| 6f 72 74 20 72 65 73 69 | 64 2c 20 6f 6c 64 72 65 |ort resi|d, oldre|
|000001e0| 73 3b 0d 20 20 20 20 42 | 6f 6f 6c 65 61 6e 20 70 |s;. B|oolean p|
|000001f0| 72 6f 67 72 65 73 73 3b | 0d 20 20 20 20 48 61 6e |rogress;|. Han|
|00000200| 64 6c 65 20 74 65 6d 70 | 48 61 6e 64 6c 65 3b 0d |dle temp|Handle;.|
|00000210| 0d 20 20 20 20 69 66 20 | 28 61 72 67 63 20 3c 20 |. if |(argc < |
|00000220| 32 29 20 7b 0d 20 20 20 | 20 20 20 20 20 66 70 72 |2) {. | fpr|
|00000230| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 20 22 23 23 |intf(std|err, "##|
|00000240| 20 20 53 74 72 69 70 55 | 6e 69 74 73 20 5b 2d 70 | StripU|nits [-p|
|00000250| 5d 20 66 69 6c 65 20 5b | 66 69 6c 65 73 5d 5c 6e |] file [|files]\n|
|00000260| 22 29 3b 0d 20 20 20 20 | 20 20 20 20 72 65 74 75 |");. | retu|
|00000270| 72 6e 20 31 3b 0d 20 20 | 20 20 7d 0d 20 20 20 20 |rn 1;. | }. |
|00000280| 49 6e 69 74 43 75 72 73 | 6f 72 43 74 6c 28 6e 69 |InitCurs|orCtl(ni|
|00000290| 6c 29 3b 0d 0d 20 20 20 | 20 66 6f 72 20 28 69 20 |l);.. | for (i |
|000002a0| 3d 20 31 3b 20 69 20 3c | 20 61 72 67 63 3b 20 69 |= 1; i <| argc; i|
|000002b0| 2b 2b 29 20 7b 0d 20 20 | 20 20 20 20 20 20 53 70 |++) {. | Sp|
|000002c0| 69 6e 43 75 72 73 6f 72 | 28 31 29 3b 0d 20 20 20 |inCursor|(1);. |
|000002d0| 20 20 20 20 20 69 66 20 | 28 21 73 74 72 63 6d 70 | if |(!strcmp|
|000002e0| 28 61 72 67 76 5b 69 5d | 2c 20 22 2d 70 22 29 29 |(argv[i]|, "-p"))|
|000002f0| 20 7b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 70 | {. | p|
|00000300| 72 6f 67 72 65 73 73 20 | 3d 20 74 72 75 65 3b 0d |rogress |= true;.|
|00000310| 20 20 20 20 20 20 20 20 | 20 20 20 20 66 6f 72 20 | | for |
|00000320| 28 6a 20 3d 20 69 20 2b | 20 31 3b 20 6a 20 3c 20 |(j = i +| 1; j < |
|00000330| 61 72 67 63 3b 20 6a 2b | 2b 29 0d 20 20 20 20 20 |argc; j+|+). |
|00000340| 20 20 20 20 20 20 20 20 | 20 20 20 61 72 67 76 5b | | argv[|
|00000350| 6a 20 2d 20 31 5d 20 3d | 20 61 72 67 76 5b 6a 5d |j - 1] =| argv[j]|
|00000360| 3b 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 61 72 |;. | ar|
|00000370| 67 63 2d 2d 3b 0d 20 20 | 20 20 20 20 20 20 20 20 |gc--;. | |
|00000380| 20 20 62 72 65 61 6b 3b | 0d 20 20 20 20 20 20 20 | break;|. |
|00000390| 20 7d 20 65 6c 73 65 0d | 20 20 20 20 20 20 20 20 | } else.| |
|000003a0| 20 20 20 20 70 72 6f 67 | 72 65 73 73 20 3d 20 66 | prog|ress = f|
|000003b0| 61 6c 73 65 3b 0d 20 20 | 20 20 7d 0d 20 20 20 20 |alse;. | }. |
|000003c0| 69 66 20 28 70 72 6f 67 | 72 65 73 73 29 20 7b 0d |if (prog|ress) {.|
|000003d0| 20 20 20 20 20 20 20 20 | 70 72 69 6e 74 66 28 22 | |printf("|
|000003e0| 5c 53 74 72 69 70 55 6e | 69 74 73 20 2d 2d 20 56 |\StripUn|its -- V|
|000003f0| 65 72 79 20 46 61 73 74 | 20 54 6f 6f 6c 20 74 6f |ery Fast| Tool to|
|00000400| 20 72 65 70 6c 61 63 65 | 20 56 65 72 79 20 53 6c | replace| Very Sl|
|00000410| 6f 77 20 53 63 72 69 70 | 74 5c 6e 22 29 3b 0d 20 |ow Scrip|t\n");. |
|00000420| 20 20 20 20 20 20 20 70 | 72 69 6e 74 66 28 22 46 | p|rintf("F|
|00000430| 65 62 72 75 61 72 79 20 | 33 2c 20 31 39 39 30 20 |ebruary |3, 1990 |
|00000440| 62 79 20 5b 47 6f 20 46 | 6f 72 20 49 74 5d 5c 6e |by [Go F|or It]\n|
|00000450| 5c 6e 22 29 3b 0d 20 20 | 20 20 7d 0d 20 20 20 20 |\n");. | }. |
|00000460| 53 65 74 52 65 73 4c 6f | 61 64 28 66 61 6c 73 65 |SetResLo|ad(false|
|00000470| 29 3b 0d 20 20 20 20 6f | 6c 64 72 65 73 20 3d 20 |);. o|ldres = |
|00000480| 43 75 72 52 65 73 46 69 | 6c 65 28 29 3b 0d 20 20 |CurResFi|le();. |
|00000490| 20 20 66 6f 72 20 28 69 | 20 3d 20 31 3b 20 69 20 | for (i| = 1; i |
|000004a0| 3c 20 61 72 67 63 3b 20 | 69 2b 2b 29 20 7b 0d 20 |< argc; |i++) {. |
|000004b0| 20 20 20 20 20 20 20 53 | 70 69 6e 43 75 72 73 6f | S|pinCurso|
|000004c0| 72 28 31 29 3b 0d 20 20 | 20 20 20 20 20 20 72 65 |r(1);. | re|
|000004d0| 73 69 64 20 3d 20 6f 70 | 65 6e 72 65 73 66 69 6c |sid = op|enresfil|
|000004e0| 65 28 61 72 67 76 5b 69 | 5d 29 3b 0d 20 20 20 20 |e(argv[i|]);. |
|000004f0| 20 20 20 20 69 66 20 28 | 52 65 73 45 72 72 6f 72 | if (|ResError|
|00000500| 28 29 29 20 7b 0d 20 20 | 20 20 20 20 20 20 20 20 |()) {. | |
|00000510| 20 20 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 | fprint|f(stderr|
|00000520| 2c 20 22 23 20 46 69 6c | 65 20 25 73 20 6e 6f 74 |, "# Fil|e %s not|
|00000530| 20 66 6f 75 6e 64 5c 6e | 22 2c 20 61 72 67 76 5b | found\n|", argv[|
|00000540| 69 5d 29 3b 0d 20 20 20 | 20 20 20 20 20 20 20 20 |i]);. | |
|00000550| 20 62 72 65 61 6b 3b 0d | 20 20 20 20 20 20 20 20 | break;.| |
|00000560| 7d 0d 20 20 20 20 20 20 | 20 20 69 66 20 28 6a 20 |}. | if (j |
|00000570| 3d 20 43 6f 75 6e 74 52 | 65 73 6f 75 72 63 65 73 |= CountR|esources|
|00000580| 28 27 75 6e 69 74 27 29 | 29 20 7b 0d 20 20 20 20 |('unit')|) {. |
|00000590| 20 20 20 20 20 20 20 20 | 66 6f 72 20 28 6b 20 3d | |for (k =|
|000005a0| 20 6a 3b 20 6b 20 3e 3d | 20 31 3b 20 6b 2d 2d 29 | j; k >=| 1; k--)|
|000005b0| 20 7b 09 2f 2a 20 48 61 | 76 65 20 74 6f 20 63 6f | {./* Ha|ve to co|
|000005c0| 75 6e 74 20 62 61 63 6b | 77 61 72 64 73 20 6f 72 |unt back|wards or|
|000005d0| 20 77 65 20 6c 6f 73 65 | 20 68 61 6c 66 20 6f 66 | we lose| half of|
|000005e0| 20 74 68 65 6d 20 2a 2f | 0d 20 20 20 20 20 20 20 | them */|. |
|000005f0| 20 20 20 20 20 20 20 20 | 20 74 65 6d 70 48 61 6e | | tempHan|
|00000600| 64 6c 65 20 3d 20 47 65 | 74 49 6e 64 52 65 73 6f |dle = Ge|tIndReso|
|00000610| 75 72 63 65 28 27 75 6e | 69 74 27 2c 20 6b 29 3b |urce('un|it', k);|
|00000620| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00000630| 20 69 66 20 28 52 65 73 | 45 72 72 6f 72 28 29 20 | if (Res|Error() |
|00000640| 26 26 20 70 72 6f 67 72 | 65 73 73 29 0d 20 20 20 |&& progr|ess). |
|00000650| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000660| 20 70 72 69 6e 74 66 28 | 22 23 20 43 6f 75 6c 64 | printf(|"# Could|
|00000670| 20 6e 6f 74 20 61 63 63 | 65 73 73 20 27 75 6e 69 | not acc|ess 'uni|
|00000680| 74 27 20 72 65 73 6f 75 | 72 63 65 20 69 6e 64 65 |t' resou|rce inde|
|00000690| 78 20 25 64 20 28 65 72 | 72 6f 72 20 3a 25 64 29 |x %d (er|ror :%d)|
|000006a0| 20 69 6e 20 66 69 6c 65 | 3a 20 25 73 5c 6e 22 0d | in file|: %s\n".|
|000006b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000006c0| 20 20 20 20 20 20 20 20 | 20 20 20 2c 6b 2c 20 52 | | ,k, R|
|000006d0| 65 73 45 72 72 6f 72 28 | 29 2c 20 61 72 67 76 5b |esError(|), argv[|
|000006e0| 69 5d 29 3b 0d 20 20 20 | 20 20 20 20 20 20 20 20 |i]);. | |
|000006f0| 20 20 20 20 20 52 6d 76 | 65 52 65 73 6f 75 72 63 | Rmv|eResourc|
|00000700| 65 28 74 65 6d 70 48 61 | 6e 64 6c 65 29 3b 0d 20 |e(tempHa|ndle);. |
|00000710| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 69 | | i|
|00000720| 66 20 28 70 72 6f 67 72 | 65 73 73 29 20 7b 0d 20 |f (progr|ess) {. |
|00000730| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000740| 20 20 20 69 66 20 28 52 | 65 73 45 72 72 6f 72 28 | if (R|esError(|
|00000750| 29 29 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |)). | |
|00000760| 20 20 20 20 20 20 20 20 | 20 20 20 70 72 69 6e 74 | | print|
|00000770| 66 28 22 23 20 43 6f 75 | 6c 64 20 6e 6f 74 20 72 |f("# Cou|ld not r|
|00000780| 65 6d 6f 76 65 20 27 75 | 6e 69 74 27 20 72 65 73 |emove 'u|nit' res|
|00000790| 6f 75 72 63 65 20 69 6e | 64 65 78 20 25 64 20 28 |ource in|dex %d (|
|000007a0| 65 72 72 6f 72 20 3a 25 | 64 29 20 69 6e 20 66 69 |error :%|d) in fi|
|000007b0| 6c 65 3a 20 25 73 5c 6e | 22 0d 20 20 20 20 20 20 |le: %s\n|". |
|000007c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000007d0| 20 20 20 20 20 20 20 20 | 20 2c 6b 2c 20 52 65 73 | | ,k, Res|
|000007e0| 45 72 72 6f 72 28 29 2c | 20 61 72 67 76 5b 69 5d |Error(),| argv[i]|
|000007f0| 29 3b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |);. | |
|00000800| 20 20 20 20 20 20 20 65 | 6c 73 65 0d 20 20 20 20 | e|lse. |
|00000810| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000820| 20 20 20 20 70 72 69 6e | 74 66 28 22 23 20 52 65 | prin|tf("# Re|
|00000830| 6d 6f 76 65 64 20 27 75 | 6e 69 74 27 20 72 65 73 |moved 'u|nit' res|
|00000840| 6f 75 72 63 65 20 69 6e | 64 65 78 20 25 64 20 69 |ource in|dex %d i|
|00000850| 6e 20 66 69 6c 65 3a 20 | 25 73 5c 6e 22 2c 20 6b |n file: |%s\n", k|
|00000860| 2c 20 61 72 67 76 5b 69 | 5d 29 3b 0d 20 20 20 20 |, argv[i|]);. |
|00000870| 20 20 20 20 20 20 20 20 | 20 20 20 20 7d 0d 20 20 | | }. |
|00000880| 20 20 20 20 20 20 20 20 | 20 20 7d 0d 20 20 20 20 | | }. |
|00000890| 20 20 20 20 7d 20 65 6c | 73 65 20 69 66 20 28 70 | } el|se if (p|
|000008a0| 72 6f 67 72 65 73 73 29 | 0d 20 20 20 20 20 20 20 |rogress)|. |
|000008b0| 20 20 20 20 20 70 72 69 | 6e 74 66 28 22 23 20 25 | pri|ntf("# %|
|000008c0| 73 20 68 61 73 20 6e 6f | 20 27 75 6e 69 74 27 20 |s has no| 'unit' |
|000008d0| 72 65 73 6f 75 72 63 65 | 5c 6e 22 2c 20 61 72 67 |resource|\n", arg|
|000008e0| 76 5b 69 5d 29 3b 0d 0d | 20 20 20 20 20 20 20 20 |v[i]);..| |
|000008f0| 43 6c 6f 73 65 52 65 73 | 46 69 6c 65 28 72 65 73 |CloseRes|File(res|
|00000900| 69 64 29 3b 0d 20 20 20 | 20 7d 0d 20 20 20 20 55 |id);. | }. U|
|00000910| 73 65 52 65 73 46 69 6c | 65 28 6f 6c 64 72 65 73 |seResFil|e(oldres|
|00000920| 29 3b 0d 7d 0d 00 00 00 | 00 00 00 00 00 00 00 00 |);.}....|........|
|00000930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000980| 00 00 01 00 00 00 01 4c | 00 00 00 4c 00 00 00 32 |.......L|...L...2|
|00000990| 5d 29 3b 0d 09 09 20 20 | 20 20 65 6c 73 65 0d 09 |]);... | else..|
|000009a0| 09 09 70 72 69 6e 74 66 | 28 22 23 20 52 65 6d 6f |..printf|("# Remo|
|000009b0| 10 53 74 72 69 70 55 6e | 69 74 73 54 6f 6f 6c 2e |.StripUn|itsTool.|
|000009c0| 63 54 02 00 00 00 54 45 | 58 54 4d 50 53 20 00 00 |cT....TE|XTMPS ..|
|000009d0| 00 00 54 45 58 54 4d 50 | 53 20 00 00 00 40 00 40 |..TEXTMP|S ...@.@|
|000009e0| 00 00 6a ca 00 00 00 00 | 00 00 00 00 00 00 00 00 |..j.....|........|
|000009f0| 00 00 a1 f8 35 e4 00 00 | 08 a5 00 00 01 7e 0d 09 |....5...|.....~..|
|00000a00| 20 20 20 20 70 72 69 6e | 74 66 28 22 23 20 25 73 | prin|tf("# %s|
|00000a10| 20 68 61 73 20 6e 6f 20 | 27 63 6b 69 64 27 20 72 | has no |'ckid' r|
|00000a20| 65 73 6f 75 72 63 65 5c | 6e 22 2c 20 61 72 67 76 |esource\|n", argv|
|00000a30| 5b 69 5d 29 3b 0d 0d 09 | 43 6c 6f 73 65 52 65 73 |[i]);...|CloseRes|
|00000a40| 46 69 6c 65 28 72 65 73 | 69 64 29 3b 0d 20 20 20 |File(res|id);. |
|00000a50| 20 7d 0d 20 20 20 20 55 | 73 65 52 65 73 46 69 6c | }. U|seResFil|
|00000a60| 65 28 6f 6c 64 72 65 73 | 29 3b 0d 7d 0d 51 c3 22 |e(oldres|);.}.Q."|
|00000a70| 08 11 50 e4 bc 39 23 27 | e4 1c 10 49 dc 98 79 23 |..P..9#'|...I..y#|
|00000a80| 00 00 00 48 00 0a 43 6f | 75 72 69 65 72 00 00 00 |...H..Co|urier...|
|00000a90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000aa0| 00 00 00 00 00 00 00 06 | 00 03 00 2d 00 0d 01 ce |........|...-....|
|00000ab0| 02 26 00 2d 00 0d 01 ce | 02 26 a1 f8 4a 15 00 00 |.&.-....|.&..J...|
|00000ac0| 00 00 00 00 00 00 00 00 | 02 36 01 00 00 00 01 00 |........|.6......|
|00000ad0| 00 00 01 4c 00 00 00 4c | 00 00 00 32 00 56 15 6c |...L...L|...2.V.l|
|00000ae0| 09 8e 00 00 00 1c 00 32 | 00 00 4d 50 53 52 00 00 |.......2|..MPSR..|
|00000af0| 00 0a 03 ed ff ff 00 00 | 00 00 00 57 de 84 00 00 |........|...W....|
+--------+-------------------------+-------------------------+--------+--------+